<template>
    <div>
        <!-- 轮播图部分 -->
        <carousel  :carouselList="carouselList" :isFull="true"></carousel>

        <!-- 九宫格部分 -->
        <ul class="mui-table-view mui-grid-view mui-grid-9">
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
                <router-link to="/home/newsList">
                <img src="../../images/menu1(1).png">
                <div class="mui-media-body">新闻资讯</div>
                </router-link>
            </li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
                <router-link to="/home/photoList">
                <img src="../../images/menu2.png">
                <div class="mui-media-body">图片分享</div>
                </router-link>
            </li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
                <router-link to="/home/goodsList">
                <img src="../../images/menu3.png">
                <div class="mui-media-body">商品购买</div>
                </router-link>
            </li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
                <router-link to="#">
                <img src="../../images/menu4.png">
                <div class="mui-media-body">留言反馈</div>
                </router-link>
            </li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
                <router-link to="#">
            <img src="../../images/menu5.png">
            <div class="mui-media-body">视频专区</div>
                </router-link>
            </li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
                <router-link to="#">
                <img src="../../images/menu6.png">
                <div class="mui-media-body">联系我们</div>
                </router-link>
            </li>
        </ul>
        <router-view></router-view>
    </div>
</template>

<script>
    // 引入 轮播图 组件
    import carousel from '../subComment/carousel.vue'

    // 引入 提示框
    import { Toast } from 'mint-ui'
    export default {
        data: function () {
            return {
                carouselList: []
            }
        },
        created() {
            this.getLunbotu()
        },
        components: {
            carousel
        },
        methods: {
            // 获取轮播图
            getLunbotu() {
                this.$http.get('api/getlunbo')
                    .then(function (data) {
                        this.carouselList = data.body.message
                        // 增加一个 src 属性
                        this.carouselList.forEach(item => {
                            item.src = item.img
                        })
                    }, function () {
                        Toast({
                            message: 'Server error 500',
                            position: 'middle',
                            duration: 5000
                        })
                    })
            }
        }
    }
</script>

<style scoped lang="less">
    /* 轮播图 */
    .mint-swipe{
        width: 100%;
        height: 200px;
        img{
            width: 100%;
            height: 200px;
        }
    }
    /* 九宫格 */
    .mui-table-view{
        width: 100%;
        background-color: #fff;
        border: none;
        li{
            border: none !important;
            img{
                width: 60px;
            }
            .mui-media-body{
                font-size: 13px !important;
            }
        }
    }
</style>